<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>鸿蒙知识练习</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            background-color: #f5f7fa;
            color: #333;
            line-height: 1.6;
            padding: 20px;
        }

        .container {
            max-width: 1000px;
            margin: 0 auto;
            padding: 20px;
        }

        header {
            text-align: center;
            margin-bottom: 30px;
            padding: 20px;
            background: linear-gradient(135deg, #0066FF 0%, #0044CC 100%);
            color: white;
            border-radius: 12px;
            box-shadow: 0 4px 12px rgba(0, 102, 255, 0.2);
        }

        h1 {
            font-size: 2.2rem;
            margin-bottom: 10px;
        }

        .description {
            font-size: 1.1rem;
            opacity: 0.9;
        }

        .quiz-type-selector {
            display: flex;
            justify-content: center;
            margin-bottom: 30px;
            flex-wrap: wrap;
            gap: 10px;
        }

        .quiz-type-btn {
            padding: 12px 24px;
            background-color: white;
            border: 2px solid #0066FF;
            border-radius: 8px;
            color: #0066FF;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .quiz-type-btn:hover {
            background-color: #e6f0ff;
        }

        .quiz-type-btn.active {
            background-color: #0066FF;
            color: white;
        }

        .questions-container {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
            gap: 20px;
        }

        .question-card {
            background-color: white;
            border-radius: 12px;
            padding: 20px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
            transition: transform 0.3s ease;
        }

        .question-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
        }

        .question-type {
            display: inline-block;
            padding: 4px 12px;
            background-color: #e6f0ff;
            color: #0066FF;
            border-radius: 20px;
            font-size: 0.85rem;
            margin-bottom: 15px;
            font-weight: 500;
        }

        .question-text {
            font-size: 1.1rem;
            margin-bottom: 20px;
            font-weight: 500;
            line-height: 1.5;
        }

        .options {
            margin-bottom: 20px;
            padding-left: 20px;
        }

        .option {
            margin-bottom: 10px;
            list-style-type: none;
            position: relative;
        }

        .option:before {
            content: "•";
            color: #0066FF;
            font-weight: bold;
            display: inline-block;
            width: 1em;
            margin-left: -1em;
        }

        .show-answer-btn {
            padding: 10px 20px;
            background-color: #0066FF;
            color: white;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-weight: 500;
            transition: background-color 0.3s ease;
            display: block;
            margin-top: 15px;
        }

        .show-answer-btn:hover {
            background-color: #0052cc;
        }

        .answer {
            margin-top: 15px;
            padding: 15px;
            background-color: #f0f7ff;
            border-radius: 8px;
            border-left: 4px solid #0066FF;
            display: none;
        }

        .answer.show {
            display: block;
            animation: fadeIn 0.5s ease;
        }

        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        @media (max-width: 768px) {
            .questions-container {
                grid-template-columns: 1fr;
            }

            .quiz-type-btn {
                padding: 10px 16px;
                font-size: 0.9rem;
            }
        }
    </style>
</head>
<body>
<div class="container">
    <header>
        <h1>鸿蒙知识练习</h1>
        <p class="description">测试你对华为鸿蒙操作系统的了解程度</p>
    </header>

    <div class="quiz-type-selector">
        <button class="quiz-type-btn active" data-type="single">单选题</button>
        <button class="quiz-type-btn" data-type="multiple">多选题</button>
        <button class="quiz-type-btn" data-type="judge">判断题</button>
        <button class="quiz-type-btn" data-type="short">简答题</button>
    </div>

    <div class="questions-container">
        <!-- 单选题 -->
        <div class="question-card" data-type="single">
            <span class="question-type">单选题</span>
            <p class="question-text">1. 鸿蒙操作系统是哪个公司开发的？</p>
            <ul class="options">
                <li class="option">A. 阿里巴巴</li>
                <li class="option">B. 腾讯</li>
                <li class="option">C. 华为</li>
                <li class="option">D. 小米</li>
            </ul>
            <button class="show-answer-btn">查看答案</button>
            <div class="answer">正确答案：C. 华为</div>
        </div>

        <div class="question-card" data-type="single">
            <span class="question-type">单选题</span>
            <p class="question-text">2. 鸿蒙操作系统首次发布时间是？</p>
            <ul class="options">
                <li class="option">A. 2018年</li>
                <li class="option">B. 2019年</li>
                <li class="option">C. 2020年</li>
                <li class="option">D. 2021年</li>
            </ul>
            <button class="show-answer-btn">查看答案</button>
            <div class="answer">正确答案：B. 2019年</div>
        </div>

        <div class="question-card" data-type="single">
            <span class="question-type">单选题</span>
            <p class="question-text">3. 鸿蒙系统的设计理念是？</p>
            <ul class="options">
                <li class="option">A. 全场景分布式体验</li>
                <li class="option">B. 单一设备优化</li>
                <li class="option">C. 仅限手机使用</li>
                <li class="option">D. 仅限物联网设备</li>
            </ul>
            <button class="show-answer-btn">查看答案</button>
            <div class="answer">正确答案：A. 全场景分布式体验</div>
        </div>

        <div class="question-card" data-type="single">
            <span class="question-type">单选题</span>
            <p class="question-text">4. 鸿蒙系统使用的主要开发语言是？</p>
            <ul class="options">
                <li class="option">A. Java</li>
                <li class="option">B. Python</li>
                <li class="option">C. JavaScript</li>
                <li class="option">D. ArkTS</li>
            </ul>
            <button class="show-answer-btn">查看答案</button>
            <div class="answer">正确答案：D. ArkTS</div>
        </div>

        <div class="question-card" data-type="single">
            <span class="question-type">单选题</span>
            <p class="question-text">5. 鸿蒙系统的分布式能力不包括？</p>
            <ul class="options">
                <li class="option">A. 分布式软总线</li>
                <li class="option">B. 分布式数据管理</li>
                <li class="option">C. 分布式设备虚拟化</li>
                <li class="option">D. 分布式独立运行</li>
            </ul>
            <button class="show-answer-btn">查看答案</button>
            <div class="answer">正确答案：D. 分布式独立运行</div>
        </div>

        <!-- 多选题 -->
        <div class="question-card" data-type="multiple">
            <span class="question-type">多选题</span>
            <p class="question-text">6. 鸿蒙系统可以应用于以下哪些设备？</p>
            <ul class="options">
                <li class="option">A. 智能手机</li>
                <li class="option">B. 智能手表</li>
                <li class="option">C. 智能家居设备</li>
                <li class="option">D. 汽车系统</li>
            </ul>
            <button class="show-answer-btn">查看答案</button>
            <div class="answer">正确答案：A、B、C、D（全部）</div>
        </div>

        <div class="question-card" data-type="multiple">
            <span class="question-type">多选题</span>
            <p class="question-text">7. 鸿蒙系统的核心技术特性包括？</p>
            <ul class="options">
                <li class="option">A. 分布式架构</li>
                <li class="option">B. 一次开发多端部署</li>
                <li class="option">C. 统一IDE</li>
                <li class="option">D. 安全可靠</li>
            </ul>
            <button class="show-answer-btn">查看答案</button>
            <div class="answer">正确答案：A、B、C、D（全部）</div>
        </div>

        <!-- 判断题 -->
        <div class="question-card" data-type="judge">
            <span class="question-type">判断题</span>
            <p class="question-text">8. 鸿蒙系统是基于Linux内核开发的。</p>
            <button class="show-answer-btn">查看答案</button>
            <div class="answer">正确答案：错误。鸿蒙系统使用微内核设计，不是基于Linux。</div>
        </div>

        <div class="question-card" data-type="judge">
            <span class="question-type">判断题</span>
            <p class="question-text">9. 鸿蒙系统只能运行在华为设备上。</p>
            <button class="show-answer-btn">查看答案</button>
            <div class="answer">正确答案：错误。鸿蒙是开源系统，其他厂商也可以使用。</div>
        </div>

        <!-- 简答题 -->
        <div class="question-card" data-type="short">
            <span class="question-type">简答题</span>
            <p class="question-text">10. 简述鸿蒙系统的分布式特性及其优势。</p>
            <button class="show-answer-btn">查看答案</button>
            <div class="answer">参考答案：鸿蒙系统的分布式特性允许不同设备无缝协同工作，形成一个"超级终端"。优势包括：设备能力共享、任务无缝流转、低延迟高吞吐的分布式通信、以及统一的安全保障机制。</div>
        </div>

        <!-- 更多题目... -->
    </div>
</div>

<script>
    document.addEventListener('DOMContentLoaded', function() {
        // 题型选择功能
        const typeButtons = document.querySelectorAll('.quiz-type-btn');
        const questionCards = document.querySelectorAll('.question-card');

        typeButtons.forEach(button => {
            button.addEventListener('click', function() {
                // 切换按钮激活状态
                typeButtons.forEach(btn => btn.classList.remove('active'));
                this.classList.add('active');

                // 显示对应类型的题目
                const type = this.getAttribute('data-type');
                questionCards.forEach(card => {
                    if (type === 'all' || card.getAttribute('data-type') === type) {
                        card.style.display = 'block';
                    } else {
                        card.style.display = 'none';
                    }
                });
            });
        });

        // 显示答案功能
        const answerButtons = document.querySelectorAll('.show-answer-btn');
        answerButtons.forEach(button => {
            button.addEventListener('click', function() {
                const answer = this.nextElementSibling;
                answer.classList.toggle('show');

                // 切换按钮文本
                if (answer.classList.contains('show')) {
                    this.textContent = '隐藏答案';
                } else {
                    this.textContent = '查看答案';
                }
            });
        });
    });
</script>
</body>
</html>

